@PACKAGE_INIT@

include(${CMAKE_CURRENT_LIST_DIR}/KFRTargets.cmake)

include(${CMAKE_CURRENT_LIST_DIR}/KFRConfigVersion.cmake)

include(CMakeFindDependencyMacro)

set(KFR_AUDIO_FLAC @KFR_AUDIO_FLAC@)
set(KFR_AUDIO_ALAC @KFR_AUDIO_ALAC@)

if (KFR_AUDIO_FLAC)
    # Search for FLAC libraries in both release and debug install dirs
    find_library(FLAC_LIBRARY_REL NAMES FLAC PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
    find_library(FLAC_LIBRARY_DBG NAMES FLAC PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@@KFR_DEBUG_INSTALL_SUFFIX@ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
    target_link_libraries(kfr_audio INTERFACE 
        $<$<CONFIG:Debug>:${FLAC_LIBRARY_DBG}>
        $<$<CONFIG:Release>:${FLAC_LIBRARY_REL}>
    )

    # Search for OGG libraries in both release and debug install dirs
    find_library(OGG_LIBRARY_REL NAMES ogg PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
    find_library(OGG_LIBRARY_DBG NAMES ogg PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@@KFR_DEBUG_INSTALL_SUFFIX@ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
    target_link_libraries(kfr_audio INTERFACE 
        $<$<CONFIG:Debug>:${OGG_LIBRARY_DBG}>
        $<$<CONFIG:Release>:${OGG_LIBRARY_REL}>
    )
endif ()

if (KFR_AUDIO_ALAC)
    # Search for ALAC libraries in both release and debug install dirs
    find_library(ALAC_LIBRARY_REL NAMES libalac PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
    find_library(ALAC_LIBRARY_DBG NAMES libalac PATHS ${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_LIBDIR@@KFR_DEBUG_INSTALL_SUFFIX@ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
    
    target_link_libraries(kfr_audio INTERFACE 
        $<$<CONFIG:Debug>:${ALAC_LIBRARY_DBG}>
        $<$<CONFIG:Release>:${ALAC_LIBRARY_REL}>
    )
endif ()
